package pruebas;

import core.IntegerDocumentFilter;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
import javax.swing.text.Document;
import javax.swing.text.DocumentFilter;
import javax.swing.text.PlainDocument;

public class TxtOnlyNumbersPrueba {

    public static void main(String[] args) {
        JTextField textField = new JTextField(10);

        JPanel panel = new JPanel();
        panel.add(textField);

        PlainDocument doc = (PlainDocument) textField.getDocument();
        doc.setDocumentFilter(new IntegerDocumentFilter(10));
        JOptionPane.showMessageDialog(null, panel);
    }
}
